#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
using namespace std;
const int MAXN=8010;
struct node {
	int data,rank;
}	s[MAXN];
bool cmp(const node &a,const node &b) {
	return a.data<b.data||(a.data==b.data&&a.rank<b.rank);
}
int a[MAXN],h[MAXN],n,q;
int main() {
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d%d",&n,&q);
	for(int i=1;i<=n;++i) {
		scanf("%d",&a[i]);
	}
	for(int i=1;i<=n;++i) {
		s[i].data=a[i];
		s[i].rank=i;
	}
	sort(s+1,s+n+1,cmp);
	for(int i=1;i<=n;++i) {
		h[s[i].rank]=i;
	}
	while(q--) {
		int op,x,v;
		scanf("%d",&op);
		if(op==1) {
			scanf("%d%d",&x,&v);
			if(a[x]!=v) {
				a[x]=v;
				for(int i=1;i<=n;++i) {
					s[i].data=a[i];
					s[i].rank=i;
				}
				sort(s+1,s+n+1,cmp);
				for(int i=1;i<=n;++i) {
					h[s[i].rank]=i;
				}
			}
			continue;
		}
		if(op==2) {
			scanf("%d",&x);
			printf("%d\n",h[x]);
			continue;
		}
	}
	return 0;
}
